package com.home.controller.admin;

import com.home.domain.po.Products;
import com.home.result.Result;
import com.home.service.IProductsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin")
@Slf4j
@Api(tags = "测试模块")
public class TestController {
    @Autowired
    private IProductsService iProductsService;
    @GetMapping("/test")
    @ApiOperation("测试服务")
    public Result<String> test(){
        return Result.success("server ok!");
    }

    @GetMapping("/list")
    public Result<List<Products>> list(){

        return Result.success(iProductsService.list());
    }
}
